<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro"
      xmlns="http://www.w3.org/1999/html">
<head>
    <th:block th:include="include :: header('出库单据历史列表')" />
</head>
<body class="gray-bg">
     <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <form id="formId">
                    <div class="select-list">
                        <ul>
<!--                            <li>-->
<!--                                <label>明细编号：</label>-->
<!--                                <input type="text" name="stockoutDetailId"/>-->
<!--                            </li>-->
                            <li>
                                <label>单据编号：</label>
                                <input type="text" name="stockoutId"/>
                            </li>
                            <li>
                                <label>出库类型：</label>
                                <select name="outType" id="outType">
                                </select>
                            </li>
<!--                            <li>-->
<!--                                <label>创建人：</label>-->
<!--                                <input type="text" name="createManId"/>-->
<!--                            </li>-->
<!--                            <li>-->
<!--                                <label>单据状态：</label>-->
<!--                                <select name="status">-->
<!--                                    <option value="">所有</option>-->
<!--                                    <option value="-1">代码生成请选择字典属性</option>-->
<!--                                </select>-->
<!--                            </li>-->
                            <li>
                                <label>批号：</label>
                                <input type="text" name="lotNo"/>
                            </li>
                            <li>
                                <label>物资编号：</label>
                                <input type="text" name="productId"/>
                            </li>
<!--                            <li>-->
<!--                                <label>计划数量：</label>-->
<!--                                <input type="text" name="quantity"/>-->
<!--                            </li>-->
<!--                            <li>-->
<!--                                <label>分配数量：</label>-->
<!--                                <input type="text" name="allotQuantity"/>-->
<!--                            </li>-->
<!--                            <li>-->
<!--                                <label>实际数量：</label>-->
<!--                                <input type="text" name="assignNum"/>-->
<!--                            </li>-->
<!--                            <li>-->
<!--                                <label>库存来源：</label>-->
<!--                                <input type="text" name="stockoutSource"/>-->
<!--                            </li>-->
<!--                            <li>-->
<!--                                <label>仓库：</label>-->
<!--                                <input type="text" name="warehouseId"/>-->
<!--                            </li>-->
<!--                            <li>-->
<!--                                <label>创建时间：</label>-->
<!--                                <input type="text" name="createDate"/>-->
<!--                            </li>-->
<!--                            <li>-->
<!--                                <label>完成时间：</label>-->
<!--                                <input type="text" class="time-input" placeholder="请选择完成时间" name="finishDate"/>-->
<!--                            </li>-->
                            <li>
                                <label>物料名称：</label>
                                <input type="text" name="productName"/>
                            </li>
                            <li>
                                <label>起止时间：</label>
                                <input type="text" placeholder="请单击选择开始时间：" name="createDate" id="createDate"/>---
                                <input type="text" placeholder="请单击选择结束时间：" name="finishDate" id="finishDate"/>
                            </li>
                            <li>
                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                            </li>
                        </ul>
                    </div>
                </form>
            </div>

            <div class="btn-group-sm" id="toolbar" role="group">
<!--                <a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="viewOutHistory:viewOutHistory:add">-->
<!--                    <i class="fa fa-plus"></i> 添加-->
<!--                </a>-->
<!--                <a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="viewOutHistory:viewOutHistory:edit">-->
<!--                    <i class="fa fa-edit"></i> 修改-->
<!--                </a>-->
<!--                <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="viewOutHistory:viewOutHistory:remove">-->
<!--                    <i class="fa fa-remove"></i> 删除-->
<!--                </a>-->
                <a class="btn btn-warning" onclick="$.table.exportExcel()" >
                    <i class="fa fa-download"></i> 导出
                </a>
            </div>
            <div class="col-sm-12 select-table table-striped">
                <table id="bootstrap-table"></table>
            </div>
        </div>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var editFlag = [[${@permission.hasPermi('viewOutHistory:viewOutHistory:edit')}]];
        var removeFlag = [[${@permission.hasPermi('viewOutHistory:viewOutHistory:remove')}]];
        var prefix = ctx + "search/viewOutHistory";
        layui.use('laydate', function () {
            var laydates = layui.laydate;
            laydates.render({
                elem: '#createDate'
                , type: 'datetime',
                /* ,range: '到' */
                format: 'yyyy-MM-dd HH:mm:ss'
            })
        })

        layui.use('laydate', function () {
            var laydates = layui.laydate;
            laydates.render({
                elem: '#finishDate'
                , type: 'datetime',
                /* ,range: '到' */
                format: 'yyyy-MM-dd HH:mm:ss'
            })
        })
        //出库单据类型
        $(document).ready(function () {
            $.post("/bas/inoroutType/list",{inOrOutTypeId:4},function(data){

                $("#outType").append("<option value=''>全部</option>");
                // alert(data.rows[0].inOrOut);
                for(var i=0;i<data.total;i++){
                    $("#outType").append("<option value="+data.rows[i].inOrOut+">"+data.rows[i].inOrOutTypeName+"</option>");
                }
            });
        });
        //单据类型
        $(document).ready(function () {
            $.post("/bas/basType/list",{parentId:'07'},function(data){

                $("#status").append("<option value="+data.rows[0].typeValue+" selected>"+data.rows[0].typeName+"</option>");

                // alert(data.rows[0].inOrOut);
                for(var i=1;i<data.total;i++){
                    $("#status").append("<option value="+data.rows[i].typeValue+">"+data.rows[i].typeName+"</option>");
                }
            });
        });

        $(function() {
            var options = {
                url: prefix + "/list",
                createUrl: prefix + "/add",
                updateUrl: prefix + "/edit/{id}",
                removeUrl: prefix + "/remove",
                exportUrl: prefix + "/export",
                modalName: "出库单据历史",
                columns: [{
                    checkbox: true
                },
                {
                    field: 'stockoutDetailId',
                    title: '明细编号'
                },
                {
                    field: 'stockoutId',
                    title: '单据编号'
                },
                {
                    field: 'outType',
                    title: '出库类型',
                    formatter:function (value, row, index){
                        if (value == "1"){
                            return "自建单出库";
                        }
                    }
                },
                {
                    field: 'createManId',
                    title: '创建人'
                },
                {
                    field: 'status',
                    title: '单据状态',
                    formatter : function (value, row, index){
                        if (value == 1) {
                            return "出库开单";
                        } else if (value == 2) {
                            return "已审核";
                        }else if(value==3){
                            return "单据执行";
                        }else if(value==4){
                            return "执行完成";
                        }else if(value==5){
                            return "单据确认";
                        }else if(value==6){
                            return "单据作废";
                        }else if(value==7){
                            return "回传完成";
                        }
                    }
                },
                {
                    field: 'lotNo',
                    title: '批号'
                },
                {
                    field: 'productId',
                    title: '物资编号'
                },
                {
                    field: 'productName',
                    title: '物料名称'
                },
                {
                    field: 'quantity',
                    title: '计划数量'
                },
                {
                    field: 'allotQuantity',
                    title: '分配数量'
                },
                {
                    field: 'assignNum',
                    title: '实际数量'
                },
                {
                    field: 'createDate',
                    title: '创建时间'
                },
                {
                    field: 'finishDate',
                    title: '完成时间'
                },
                // {
                //     field: 'stockoutSource',
                //     title: '库存来源'
                // },
               /* {
                    field: 'warehouseId',
                    title: '仓库',
                    formatter:function (value, row, index){
                        if (value == "01"){
                            return "立体库";
                        }
                    }
                }*/]
            };
            $.table.init(options);
        });
    </script>
</body>
</html>